
<?php
//$this->template->add_admin_js_lib("unicorn.interface.js");
$this->template->add_admin_js_lib("jquery.gritter.min.js");
$this->template->add_admin_css_lib("jquery.gritter.css");
?>

<div class="row">
	<div class="col-12 center" style="text-align: center;">					
		<ul class="stat-boxes">
			<li class="popover-games">
				<div class="right">
					<strong><?php echo $game['total'];?></strong>
					Games
				</div>
			</li>
		</ul>
	</div>	
</div>


<div class="widget-box">
<div class="widget-title">
	<h5>Bảng điều khiển</h5>
</div>
<div class="widget-content">
	
	Xin chào <?php echo $this->madmin->adm_account;?><br>
	Giờ server:  <span id="clock"></span>
	
</div>
</div>
<?php
//$date = new DateTime();
//$current_timestamp = $date->getTimestamp();
$current_timestamp = 0;
?>
<script>

var placement = 'bottom';
var trigger = 'hover';
var html = true;

$('.popover-games').popover({
	placement: placement,
	content: '<span class="content-big"><?php echo $game['total'];?></span> <span class="content-small">Tổng Games</span><br /><span class="content-big"><?php echo $game['status_h3'];?></span> <span class="content-small">Game lưu tạm</span><br /><span class="content-big"><?php echo $game['status_h2'];?></span> <span class="content-small">Game chờ test</span><br /><span class="content-big"><?php echo $game['status_h1'];?></span> <span class="content-small">Game chờ duyệt</span><br /><span class="content-big"><?php echo $game['status_1'];?></span> <span class="content-small">Game đang chạy</span><br /><span class="content-big"><?php echo $game['status_0'];?></span> <span class="content-small">Game ẩn</span>',
	trigger: trigger,
	html: html   
});


flag = true;
timer = '';
setInterval(function(){phpJavascriptClock();},1000);

function phpJavascriptClock()
{
	if ( flag ) {
		timer = <?php echo $current_timestamp;?>*1000;
	}
	var d = new Date(timer);
	//months = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec');
	months = new Array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');

	month_array = new Array('January', 'Febuary', 'March', 'April', 'May', 'June', 'July', 'Augest', 'September', 'October', 'November', 'December');

	currentYear = d.getFullYear();
	month = d.getMonth();
	var currentMonth = months[month];
	var currentMonth1 = month_array[month];
	var currentDate = d.getDate();
	currentDate = currentDate < 10 ? '0'+currentDate : currentDate;

	var hours = d.getHours();
	var minutes = d.getMinutes();
	var seconds = d.getSeconds();

	var ampm = hours >= 12 ? 'PM' : 'AM';
	hours = hours % 12;
	hours = hours ? hours : 12; // the hour ’0' should be ’12'
	minutes = minutes < 10 ? '0'+minutes : minutes;
	seconds = seconds < 10 ? '0'+seconds : seconds;
	var strTime = hours + ':' + minutes+ ':' + seconds + ' ' + ampm;
	
	 
	$("#clock").text(currentDate+"/"+currentMonth+"/"+currentYear+" "+strTime);
	//document.getElementById("clock").innerHTML= currentMonth+' ' + currentDate+' , ' + currentYear + ' ' + strTime ;

	//document.getElementById("demo1").innerHTML= currentMonth1+' ' + currentDate+' , ' + currentYear + ' ' + strTime ;

	//document.getElementById("demo2").innerHTML= currentDate+':' +month+':' +currentYear + ' ' + strTime ;

	//document.getElementById("demo3").innerHTML= strTime ;

	flag = false;
	timer = timer + 1000;
}

        </script>